package utils

import "regexp"

// IsImage 判断是否是图片
func IsImage(filename string) bool {
	imageExtensions := `(?i)\.(jpg|jpeg|png|gif|bmp|svg|webp)$`
	match, _ := regexp.MatchString(imageExtensions, filename)
	return match
}

// IsVideo 判断是否是视频
func IsVideo(filename string) bool {
	videoExtensions := `^.*\.(mp4|m4v|avi|divx|xvid|wmv|flv|mkv|mpeg|mpg|mov|qt|webm|ogv)$`
	match, _ := regexp.MatchString(videoExtensions, filename)
	return match
}
